import 'package:flutter/services.dart';
import 'package:trollee/app/components/custom_icon_button.dart';
import 'package:trollee/app/core/core.dart';

class CustomAppBar extends AppBar {
  CustomAppBar({
    Key? key,
    Widget? leading,
    Widget? title,
    String? titleText,
    List<Widget>? actions,
    double? elevation,
    Color? shadowColor,
    Color? foregroundColor,
    Color backgroundColor = AppColors.background_color_white,
    bool centerTitle = false,
    VoidCallback? onBack,
    SystemUiOverlayStyle? systemOverlayStyle,

    /// 是否显示底部圆角
    bool isRound = false,
  }) : super(
          key: key,
          leading: leading ??
              CustomIconButton(
                AppIcons.general_ic_around_left_black,
                size: AppDimens.dp24,
                color: AppColors.font_color_primary,
                onPressed: onBack ?? Get.back,
              ),
          title: title ??
              (titleText != null
                  ? Text(
                      titleText,
                      style: AppTextStyles.text_16_bold_primary.line_height1_2,
                    )
                  : null),
          actions: actions,
          elevation: elevation ?? 2,
          backgroundColor: backgroundColor,
          foregroundColor: foregroundColor,
          shadowColor: shadowColor ?? AppShadows.appbarShadow.color,
          centerTitle: centerTitle,
          titleSpacing: 0,
          shape: isRound
              ? const RoundedRectangleBorder(
                  borderRadius:
                      BorderRadius.vertical(bottom: Radius.circular(10)))
              : null,
          systemOverlayStyle: systemOverlayStyle,
        );
}
